addArtifactFactoryObject() Method |
This method registers an ArtifactFactoryType to the Artifact Viewer component, based on the object passed to it.
Syntax
oNode = artifactViewerControlID.addArtifactFactoryObject( factoryObject )
Parameters
Parameter |
Description |
---|---|
factoryObject |
Required. Refers to the object of the function that extended ArtifactFactoryType. |
Return Value
It returns the object passed to the method if it is successfully added, otherwise it returns undefined.
Remarks
This method helps register artifact factory objects, which is the starting point for adding artifacts to the Artifact Viewer. This is shown in the below example.
You can use this method to add a factory type to Artifact Viewer.
Example
The following sample code demonstrates the use of this method.
//import ArtifactFactoryType into application application.importType("wcp.library.util.ArtifactFactoryType"); //extend ArtifactFactoryType Application.inherit(OrdersArtifactFactoryType, ArtifactFactoryType); function OrdersArtifactFactoryType() { } /** this method returns type of an artifact **/ OrdersArtifactFactoryType.prototype.getType = function() { return "Orders"; } /** this method helps to add behavior to each and every artifact **/ OrderArtifactFactory.prototype.addArtifactBehavior = function( applicationDefinition ) { return new OrdersArtifact( applicationDefinition ); } function OrdersArtifact( applicationDefintiion ) { } //create object for OrdersArtifactFactoryType and pass to addArtifactFactoryObject method var artifactFactoryObject = <<artifactviewerid>>. addArtifactFactoryObject( new OrdersArtifactFactoryType() ); //add the required artifacts